home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / misc / sci / Squid.lha / Squid / Squid.s < prev    next >
Encoding:
Text File  |  2001-06-23  |  5.7 KB  |  367 lines

  1.  
  2. ; Storm C Compiler
  3. ; Euterpe:Science/Emperor/Projects/Squid.cpp
  4.     mc68030
  5.     mc68881
  6.     XREF    _malloc
  7.     XREF    _free
  8.     XREF    endl__R07ostream
  9.     XREF    op__leftshift__ostream__Td
  10.     XREF    op__leftshift__ostream__TUj
  11.     XREF    op__leftshift__ostream__Tj
  12.     XREF    op__leftshift__ostream__TPCc
  13.     XREF    op__leftshift__ostream__Tc
  14.     XREF    opfx__ostream__T
  15.     XREF    read__istream__TPci
  16.     XREF    get__istream__TRc
  17.     XREF    getline__istream__TPcic
  18.     XREF    get__istream__TPcic
  19.     XREF    op__rightshift__istream__TRi
  20.     XREF    op__rightshift__istream__TRc
  21.     XREF    op__rightshift__istream__TPc
  22.     XREF    doallocate__streambuf__T
  23.     XREF    xsgetn__streambuf__TPci
  24.     XREF    xsputn__streambuf__TPCci
  25.     XREF    underflow__streambuf__T
  26.     XREF    overflow__streambuf__Ti
  27.     XREF    setbuf__streambuf__TPcUi
  28.     XREF    sputn__streambuf__TPCci
  29.     XREF    _0dt__streambuf__T
  30.     XREF    userword__ios__Ti
  31.     XREF    init__ios__TP09streambuf
  32.     XREF    _std__in
  33.     XREF    _std__out
  34.     XREF    _std__err
  35.     XREF    _basefield__ios
  36.     XREF    _adjustfield__ios
  37.     XREF    _floatfield__ios
  38.     XREF    _aNextBit__ios
  39.     XREF    _aNextWord__ios
  40.     XREF    _cin
  41.     XREF    _cout
  42.     XREF    _cerr
  43.     XREF    _clog
  44.  
  45.     SECTION ":0",CODE
  46.  
  47.  
  48. ;Cell::Cell()
  49.     XDEF    _0ct__Cell__T
  50. _0ct__Cell__T
  51. L31    EQU    0
  52.     link    a5,#L31
  53.     move.l    $8(a5),a0
  54. L30
  55. ;    cx=0;
  56.     clr.l    (a0)
  57. ;    cy=0;
  58.     clr.l    4(a0)
  59. ;    a=0;
  60.     clr.l    $8(a0)
  61. ;    b=0;
  62.     clr.l    $C(a0)
  63.     unlk    a5
  64.     rts
  65.  
  66. ;Cell::~Cell()
  67.     XDEF    _0dt__Cell__T
  68. _0dt__Cell__T
  69. L33    EQU    0
  70.     link    a5,#L33
  71. L32
  72. ;Cell::~Cell()
  73.     unlk    a5
  74.     rts
  75.  
  76. ;void Cell::set_cx(int stuff)
  77.     XDEF    set_cx__Cell__Ti
  78. set_cx__Cell__Ti
  79. L35    EQU    0
  80.     link    a5,#L35
  81.     move.l    $C(a5),d0
  82.     move.l    $8(a5),a0
  83. L34
  84. ;    cx=stuff;
  85.     move.l    d0,(a0)
  86.     unlk    a5
  87.     rts
  88.  
  89. ;void Cell::set_cy(int stuff)
  90.     XDEF    set_cy__Cell__Ti
  91. set_cy__Cell__Ti
  92. L37    EQU    0
  93.     link    a5,#L37
  94.     move.l    $C(a5),d0
  95.     move.l    $8(a5),a0
  96. L36
  97. ;    cy=stuff;
  98.     move.l    d0,4(a0)
  99.     unlk    a5
  100.     rts
  101.  
  102. ;void Cell::set_a(int stuff)
  103.     XDEF    set_a__Cell__Ti
  104. set_a__Cell__Ti
  105. L39    EQU    0
  106.     link    a5,#L39
  107.     move.l    $C(a5),d0
  108.     move.l    $8(a5),a0
  109. L38
  110. ;    a=stuff;
  111.     move.l    d0,$8(a0)
  112.     unlk    a5
  113.     rts
  114.  
  115. ;void Cell::set_b(int stuff)
  116.     XDEF    set_b__Cell__Ti
  117. set_b__Cell__Ti
  118. L41    EQU    0
  119.     link    a5,#L41
  120.     move.l    $C(a5),d0
  121.     move.l    $8(a5),a0
  122. L40
  123. ;    b=stuff;
  124.     move.l    d0,$C(a0)
  125.     unlk    a5
  126.     rts
  127.  
  128. ;int Cell::get_cx() const
  129.     XDEF    get_cx__Cell__CT
  130. get_cx__Cell__CT
  131. L43    EQU    0
  132.     link    a5,#L43
  133.     move.l    $8(a5),a0
  134. L42
  135.     move.l    (a0),d0
  136.     unlk    a5
  137.     rts
  138.  
  139. ;int Cell::get_cy() const
  140.     XDEF    get_cy__Cell__CT
  141. get_cy__Cell__CT
  142. L45    EQU    0
  143.     link    a5,#L45
  144.     move.l    $8(a5),a0
  145. L44
  146.     move.l    4(a0),d0
  147.     unlk    a5
  148.     rts
  149.  
  150. ;int Cell::get_a() const
  151.     XDEF    get_a__Cell__CT
  152. get_a__Cell__CT
  153. L47    EQU    0
  154.     link    a5,#L47
  155.     move.l    $8(a5),a0
  156. L46
  157.     move.l    $8(a0),d0
  158.     unlk    a5
  159.     rts
  160.  
  161. ;int Cell::get_b() const
  162.     XDEF    get_b__Cell__CT
  163. get_b__Cell__CT
  164. L49    EQU    0
  165.     link    a5,#L49
  166.     move.l    $8(a5),a0
  167. L48
  168.     move.l    $C(a0),d0
  169.     unlk    a5
  170.     rts
  171.  
  172. ;void main()
  173.     XDEF    main_
  174. main_
  175. L75    EQU    -$C
  176.     link    a5,#L75
  177.     movem.l    d2/a2,-(a7)
  178. L56
  179. ;    int x=0
  180.     clr.l    -4(a5)
  181. ;    int x=0, i=0;
  182. ;    cout <<"combien d'objets? ";
  183.     move.l    #L50,-(a7)
  184.     move.l    _cout,a0
  185.     cmp.w    #0,a0
  186.     beq.b    L58
  187. L57
  188.     addq.w    #4,a0
  189. L58
  190.     move.l    a0,-(a7)
  191.     jsr    op__leftshift__ostream__TPCc
  192.     addq.w    #$8,a7
  193. ;    cin >>x;
  194.     pea    -4(a5)
  195.     move.l    _cin,a0
  196.     cmp.w    #0,a0
  197.     beq.b    L60
  198. L59
  199.     addq.w    #4,a0
  200. L60
  201.     move.l    a0,-(a7)
  202.     jsr    op__rightshift__istream__TRi
  203.     addq.w    #$8,a7
  204. ;    Cell *C = (Cell*) malloc(x*sizeof(Cell));
  205.     move.l    -4(a5),d0
  206.     moveq    #4,d1
  207.     asl.l    d1,d0
  208.     move.l    d0,-(a7)
  209.     jsr    _malloc
  210.     addq.w    #4,a7
  211.     move.l    d0,a2
  212. ;    if(C==NULL)
  213.     cmp.w    #0,a2
  214.     bne.b    L64
  215. L61
  216. ;    
  217. ;        cout <<"erreur d'allocation\n";
  218.     move.l    #L51,-(a7)
  219.     move.l    _cout,a0
  220.     cmp.w    #0,a0
  221.     beq.b    L63
  222. L62
  223.     addq.w    #4,a0
  224. L63
  225.     move.l    a0,-(a7)
  226.     jsr    op__leftshift__ostream__TPCc
  227.     addq.w    #$8,a7
  228.     bra    L74
  229. L64
  230. ;    
  231. ;        cout <<"allocation de " <<x <<" objets effectuée\n";
  232.     move.l    #L52,-(a7)
  233.     move.l    -4(a5),-(a7)
  234.     move.l    #L53,-(a7)
  235.     move.l    _cout,a0
  236.     cmp.w    #0,a0
  237.     beq.b    L66
  238. L65
  239.     addq.w    #4,a0
  240. L66
  241.     move.l    a0,-(a7)
  242.     jsr    op__leftshift__ostream__TPCc
  243.     addq.w    #$8,a7
  244.     move.l    d0,-(a7)
  245.     jsr    op__leftshift__ostream__Ti
  246.     addq.w    #$8,a7
  247.     move.l    d0,-(a7)
  248.     jsr    op__leftshift__ostream__TPCc
  249.     addq.w    #$8,a7
  250. ;        cout <<"la mémoire utilisée est de " <<x*sizeof(Cell)
  251.     move.l    #L54,-(a7)
  252.     move.l    -4(a5),d0
  253.     moveq    #4,d1
  254.     asl.l    d1,d0
  255.     move.l    d0,-(a7)
  256.     move.l    #L55,-(a7)
  257.     move.l    _cout,a0
  258.     cmp.w    #0,a0
  259.     beq.b    L68
  260. L67
  261.     addq.w    #4,a0
  262. L68
  263.     move.l    a0,-(a7)
  264.     jsr    op__leftshift__ostream__TPCc
  265.     addq.w    #$8,a7
  266.     move.l    d0,-(a7)
  267.     jsr    op__leftshift__ostream__TUi
  268.     addq.w    #$8,a7
  269.     move.l    d0,-(a7)
  270.     jsr    op__leftshift__ostream__TPCc
  271.     addq.w    #$8,a7
  272. ;        for(i=0;
  273.     moveq    #0,d2
  274.     bra.b    L72
  275. L69
  276. ;        
  277. ;            cout <<C[i].get_cx() <<endl;
  278.     move.l    #endl__R07ostream,-(a7)
  279.     move.l    d2,d0
  280.     asl.l    #4,d0
  281.     pea    0(a2,d0.l)
  282.     jsr    get_cx__Cell__CT
  283.     addq.w    #4,a7
  284.     move.l    d0,-(a7)
  285.     move.l    _cout,a0
  286.     cmp.w    #0,a0
  287.     beq.b    L71
  288. L70
  289.     addq.w    #4,a0
  290. L71
  291.     move.l    a0,-(a7)
  292.     jsr    op__leftshift__ostream__Ti
  293.     addq.w    #$8,a7
  294.     move.l    d0,-(a7)
  295.     jsr    op__leftshift__ostream__TPFR07ostreamR07ostreamp
  296.     addq.w    #$8,a7
  297.     addq.l    #1,d2
  298. L72
  299.     cmp.l    -4(a5),d2
  300.     blt.b    L69
  301. L73
  302. ;        free(C);
  303.     move.l    a2,-(a7)
  304.     jsr    _free
  305.     addq.w    #4,a7
  306. L74
  307.     movem.l    (a7)+,d2/a2
  308.     unlk    a5
  309.     moveq    #0,d0
  310.     rts
  311.  
  312.     XDEF    op__leftshift__ostream__TPFR07ostreamR07ostreamp
  313. op__leftshift__ostream__TPFR07ostreamR07ostreamp
  314. L77    EQU    0
  315.     link    a5,#L77
  316.     move.l    $C(a5),a0
  317.     move.l    $8(a5),a1
  318. L76
  319.     move.l    a1,-(a7)
  320.     jsr    (a0)
  321.     addq.w    #4,a7
  322.     unlk    a5
  323.     rts
  324.  
  325.     XDEF    op__leftshift__ostream__TUi
  326. op__leftshift__ostream__TUi
  327. L79    EQU    0
  328.     link    a5,#L79
  329.     move.l    $C(a5),d0
  330.     move.l    $8(a5),a0
  331. L78
  332.     move.l    d0,-(a7)
  333.     move.l    a0,-(a7)
  334.     jsr    op__leftshift__ostream__TUj
  335.     addq.w    #$8,a7
  336.     unlk    a5
  337.     rts
  338.  
  339.     XDEF    op__leftshift__ostream__Ti
  340. op__leftshift__ostream__Ti
  341. L81    EQU    0
  342.     link    a5,#L81
  343.     move.l    $C(a5),d0
  344.     move.l    $8(a5),a0
  345. L80
  346.     move.l    d0,-(a7)
  347.     move.l    a0,-(a7)
  348.     jsr    op__leftshift__ostream__Tj
  349.     addq.w    #$8,a7
  350.     unlk    a5
  351.     rts
  352.  
  353. L52
  354.     dc.b    ' objets effectuée',$A,0
  355. L54
  356.     dc.b    ' octets',$A,0
  357. L53
  358.     dc.b    'allocation de ',0
  359. L50
  360.     dc.b    'combien d'objets? ',0
  361. L51
  362.     dc.b    'erreur d'allocation',$A,0
  363. L55
  364.     dc.b    'la mémoire utilisée est de ',0
  365.  
  366.     END
  367.